package com.lyx.module1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

import com.lyx.base.IModule2Interface;

import org.w3c.dom.Text;

import java.util.Iterator;
import java.util.ServiceLoader;

public class Module1Activity extends AppCompatActivity {

    private TextView contentTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_module1);
        contentTv = findViewById(R.id.contentTv);
    }

    @Override
    protected void onResume() {
        super.onResume();
        ServiceLoader<IModule2Interface> loader = ServiceLoader.load(IModule2Interface.class);
        Iterator<IModule2Interface> iterator = loader.iterator();
        while (iterator.hasNext()) {
            IModule2Interface next = iterator.next();
            String module2CarStatus = next.getModule2CarStatus();
            boolean module2Installing = next.getModule2Installing();
            contentTv.setText("moduleCarStatus:" + module2CarStatus + "\n\n" + "module2Installing:" + module2Installing);
        }
    }

}